package com.opesoft.fw.i18n.taglib;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.log4j.Logger;

import com.opesoft.fw.i18n.I18nBO;

/**
 * <h1>根据当前用户的语言来判断是否显示</h1>
 * 
 * @author larlf
 * 
 */
public class If extends TagSupport
{
	Logger log=Logger.getLogger(this.getClass());

	String lang;

	@Override
	public int doStartTag() throws JspException
	{
		if(lang!=null)
		{
			if(!lang.equals(I18nBO.getUserLang())) return Tag.SKIP_BODY;
		}

		return Tag.EVAL_BODY_INCLUDE;
	}

	public String getLang()
	{
		return lang;
	}

	public void setLang(String lang)
	{
		this.lang=lang;
	}

}
